FROM registry.cn-hangzhou.aliyuncs.com/sn-pub/golang:1.22.1 AS builder

ENV GOPROXY=https://goproxy.cn,direct

RUN mkdir ./app

WORKDIR /app

COPY . .

RUN go mod tidy

RUN go build ./main.go

FROM registry.cn-hangzhou.aliyuncs.com/sn-pub/golang:centos7.9

WORKDIR /app

COPY --from=builder ./app/main ./main
COPY --from=builder /app/config.yaml ./config.yaml

CMD ["./main"]
